<!--
 * @Author: coman
 * @LastEditors: coman
 * @Date: 2020-06-15 18:58:12
 * @motto: No pain,No gain
 * @LastEditTime: 2020-06-15 19:38:58
--> 
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style type="text/css">
        * {
            padding: 0;
            margin: 0;
        }

        li {
            list-style: none;
        }

        body {
            background: #f6f9fc;
            font-family: arial;
        }

        .calendar {
            width: 210px;
            margin: 0 auto;
            padding: 10px 10px 20px 20px;
            background: #eae9e9;
        }

        .calendar ul {
            width: 210px;
            overflow: hidden;
            padding-bottom: 10px;
        }

        .calendar li {
            float: left;
            width: 58px;
            height: 54px;
            margin: 10px 10px 0 0;
            border: 1px solid #fff;
            background: #424242;
            color: #fff;
            text-align: center;
            cursor: pointer;
        }

        .calendar li h2 {
            font-size: 20px;
            padding-top: 5px;
        }

        .calendar li p {
            font-size: 14px;
        }

        .calendar .active {
            border: 1px solid #424242;
            background: #fff;
            color: #e84a7e;
        }

        .calendar .active p {
            font-weight: bold;
        }

        .calendar .text {
            width: 178px;
            padding: 0 10px 10px;
            border: 1px solid #fff;
            padding-top: 10px;
            background: #f1f1f1;
            color: #555;
        }

        .calendar .text h2 {
            font-size: 14px;
            margin-bottom: 10px;
        }

        .calendar .text p {
            font-size: 12px;
            line-height: 18px;
        }
    </style>
</head>

<body>
    <div id="tab" class="calendar">

        <ul id="ul">
            <li  id="li1">
                <h2>1</h2>
                <p>JAN</p>
            </li>
            <li id="li2">
                <h2>2</h2>
                <p>FER</p>
            </li>
            <li id="li3">
                <h2>3</h2>
                <p>MAR</p>
            </li>
            <li id="li4">
                <h2>4</h2>
                <p>APR</p>
            </li>
            <li id="li5">
                <h2>5</h2>
                <p>MAY</p>
            </li>
            <li id="li6">
                <h2>6</h2>
                <p>JUN</p>
            </li>
            <li id="li7">
                <h2>7</h2>
                <p>JUL</p>
            </li>
            <li id="li8">
                <h2>8</h2>
                <p>AUG</p>
            </li>
            <li id="li9">
                <h2>9</h2>
                <p>SEP</p>
            </li>
            <li id="li10">
                <h2>10</h2>
                <p>OCT</p>
            </li>
            <li id="li11">
                <h2>11</h2>
                <p>NOV</p>
            </li>
            <li id="li12">
                <h2>12</h2>
                <p>DEC</p>
            </li>
        </ul>

        <div class="text" id="txt">

        </div>

    </div>
    <script>
        var li_num =  document.getElementById("ul").getElementsByTagName("li");
        for(var i=0;i<li_num.length;i++){
            li_num[i].idx=i;
            li_num[i].onclick = function(){
                for(var i=0;i<li_num.length;i++){
                    li_num[i].className=" ";
                }

                
                this.className="active";
               switch(this.idx){
                   case 0:
                        txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"1月春节"+"</p>"
                        break;
                    case 1:
                    txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"2月春节"+"</p>"
                    break;
                    case 2:
                    txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"3月春节"+"</p>"
                    break;
                    case 3:
                    txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"4月春节"+"</p>"
                    break;
                    case 4:
                    txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"5月春节"+"</p>"
                    break;
                    case 5:
                    txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"6月春节"+"</p>"
                    break;
                    case 6:
                    txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"7月春节"+"</p>"
                    break;
                    case 7:
                    txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"8月春节"+"</p>"
                    break;
                    case 8:
                    txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"9月春节"+"</p>"
                    break;
                    case 9:
                    txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"10月春节"+"</p>"
                    break;
                    case 10:
                    txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"11月春节"+"</p>"
                    break;
                    case 11:
                    txt.innerHTML=" <h2>"+"这里是"+(this.idx+1)+"月份"+"</h2>"+"<p>"+"12月春节"+"</p>"
                    break;
               }
            }
        }
    </script>
</body>

</html>